<template>
	<view class="homeCon">
		<u-navbar :title="value" :background="{ background: '#a0cfff' }" title-color="#FFFFFF"></u-navbar>
		<view class="homeSelect">
			<view class="homeT flex-sbc u-m-15">
				<view class="left">
					<u-input v-model="value" />
				</view>
				<view class="right">
					<u-button type="warning" shape="circle" size="mini" @click="selectClick()">搜索</u-button>
				</view>
			</view>
		</view>
		<view class="u-m-l-15 u-m-r-15">
			<shop :flowList="shopList"></shop>
		</view>

	</view>
</template>

<script>
	import shop from '../../components/shop.vue'
	import helper from '../../common/helper.js'
	export default {
		components: {
			shop
		},
		data() {
			return {
				value: '',
				shopList: []
			}
		},
		onLoad:function(options){
			let that = this
			if(options.title != ""){
				that.value = options.title
				that.getShop()
			}
		},
		created() {
			
		},
		methods: {
			selectClick(){
				this.getShop()
			},
			getShop(){
				let that = this
				let data = {
					query: that.value
				}
				that.getRequest(helper.getSign,data).then(res => {
					if(res.data.flag == "200"){
						let serve = res.data
						serve.shopList.forEach((item,index) => {
							if(item.shopUrl.indexOf("<<tupian>>") > 0){
								item.shopUrl = item.shopUrl.split("<<tupian>>")[0]
								// console.log(index)
							}
						})
						that.shopList = serve.shopList
					}
				})
			},
		}
	}
</script>
<style>
	page {
		background-color: rgb(240, 240, 240);
	}
</style>
<style lang="scss" scoped>
	.homeCon {
		.homeSelect {
			.homeT {
				width: calc(100%-30rpx);
				height: 70rpx;
				border-radius: 50rpx;
				border: 2rpx solid #FF6101;
				background-color: #FFFFFF;

				.left {
					width: 83%;
					padding-left: 25rpx;
				}

				.right {
					width: 13%;
				}
			}
		}

		.tipC {
			background-color: #FFFFFF;
			border-radius: 20rpx;
			display: flex;
			flex-wrap: wrap;
			width: calc(100-30rpx);

			.tipS {
				width: 20%;
				height: 170rpx;

				.tipTu {
					display: flex;
					flex-direction: column;

					.tipTitle {

						font-size: 26rpx;
						text-align: center;
					}
				}

			}
		}
	}
</style>
